#==============================================================
#  1.  工程信息：按需修改
# cmake -B build -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Debug /默认留空
# cmake -B build -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release
# cmake --build build
#==============================================================
set(PROJ_NAME      "ImGui")     # 可执行文件名称
set(PROJ_CXX_STD   17)         # C++ 标准 C++ 11 /C++14 /C++17 /C++ 20 /C++ 23
set(IMGUI_DIR      ${CMAKE_CURRENT_SOURCE_DIR}/)  # 头文件目录
set(SRC_LIST                                    # 全部源文件
Imgui_Small.rc
    Imgui_Small.cpp
    hpp/imgui.cpp
    hpp/imgui_draw.cpp
    hpp/imgui_impl_dx12.cpp
    hpp/imgui_impl_glfw.cpp
    hpp/imgui_impl_opengl3.cpp
    hpp/imgui_impl_win32.cpp
    hpp/imgui_tables.cpp
    hpp/imgui_widgets.cpp
)

#==============================================================
#  2.  基本设定（勿动）
#==============================================================
cmake_minimum_required(VERSION 3.15)
project(${PROJ_NAME} CXX)
set(CMAKE_CXX_STANDARD ${PROJ_CXX_STD})
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

#==============================================================
#  3.  第三方：空属性自动注释
#==============================================================
enable_language(C)
add_library(Other_Library STATIC IMPORTED GLOBAL)
set_target_properties(Other_Library PROPERTIES
    IMPORTED_LOCATION_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/lib/glfw3_d.lib"
    IMPORTED_LOCATION_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/lib/glfw3.lib"
    INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/include"
)

#==============================================================
#  4.  可执行目标 & 链接（勿动）
#==============================================================
add_executable(${PROJ_NAME} ${SRC_LIST})
target_include_directories(${PROJ_NAME} PRIVATE ${IMGUI_DIR})
target_link_libraries(${PROJ_NAME} PRIVATE
    Other_Library opengl32 gdi32 shell32 user32 comctl32 ole32 oleaut32 uuid ws2_32 winmm)

#==============================================================
#  5.  子系统选择（勿动）
#==============================================================
option(USE_GUI_SUBSYSTEM "Use Windows subsystem instead of console" OFF)
if(USE_GUI_SUBSYSTEM)
    set_target_properties(${PROJ_NAME} PROPERTIES WIN32_EXECUTABLE TRUE)
else()
    set_target_properties(${PROJ_NAME} PROPERTIES LINK_FLAGS "/SUBSYSTEM:CONSOLE")
endif()
